package com.bwie.controller;

import com.bwie.service.TbUserService;
import com.bwie.utils.Result;
import com.bwie.vo.LoginVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/auth/user")
public class UserController {

    @Autowired
    TbUserService tbUserService;

    /**
     * @description 发送验证码
     * @params [mobile]
     * @return com.bwie.utils.Result
     * @author 杰
     * @date 2025/6/11 13:39
     */
    @PostMapping("/sendCode/{mobile}")
    public Result sendCode(@PathVariable("mobile") String mobile){
        return tbUserService.sendCode(mobile);
    }



    /**
     * @description 登录接口
     * @params []
     * @return com.bwie.utils.Result
     * @author 杰
     * @date 2025/6/6 15:49
     */
    @PostMapping("/login")
    public Result login(@RequestBody @Validated LoginVo loginVo){

        return tbUserService.login(loginVo);

    }
}
